#ifndef _MAPDISPLAY_H
#define	_MAPDISPLAY_H

//includes-----------------------------
#include <gtkmm/drawingarea.h>
#include <gtkmm/label.h>
#include <gtkmm/table.h>
#include <gdk/gdkkeysyms.h>
#include <cairomm/context.h>
#include <glibmm/refptr.h>
#include <sigc++/sigc++.h>
#include "icon.h"

//defines------------------------------
#define mapCursor sigc::signal<void, int , int>

//prototypes---------------------------
class mapScreen;
class mapDisplay;
class tileDisp;
class mapCursClient;

//definitions--------------------------
class mapScreen : public Gtk::Table{
    public:
        //constructors
        mapScreen();
        ~mapScreen();
        //manips
        int  activePlayer();
        void activePlayer(int p);
        void dispMesage(string msg);
        void requestCursor(mapCursClient* client);
    protected:
        //overides
        virtual bool on_key_press_event(GdkEventKey* event);
        virtual bool on_button_press_event(GdkEventButton* event);
        virtual bool on_focus_in_event(GdkEventFocus* event);
    private:
        int activeP;
        mapDisplay* rep;
        Gtk::Label messageLabel;
};

class mapDisplay : public Gtk::DrawingArea{
    public:
        //constructs
        mapDisplay();
        mapDisplay(int x, int y);
        mapDisplay(int x, int y, int playerNum);
        ~mapDisplay();
        //manips
        void requestCursor(mapCursClient* client);
        void draw();
        bool keypress(GdkEventKey* btn);
    protected:
        void scroll();
        //overides
        virtual bool on_expose_event(GdkEventExpose* event);
        virtual bool on_button_press_event(GdkEventButton* event);
        virtual bool on_key_press_event(GdkEventKey* event);
    private:
        mapCursor cursSig;
        int cursor[2];
        int offset[2];
        int dims[2];
        int activeP;
        tileDisp ***feck;
};

class tileDisp : public Gtk::Widget{
    public:
        //construct
        tileDisp();
        tileDisp(int x, int y);
        ~tileDisp();
        //manips
        void curs(bool hasCurs);
        void set(int x, int y);
        void draw();
        //icon manips
        icon* topLevel();
        icon* bGrnd();
        void  addIcn(icon* icon);
        void  remIcn(icon* icon);
        //overides
        virtual bool on_button_press_event(GdkEventButton* event);
        virtual bool on_expose_event(GdkEventExpose* event);
    protected:
    private:
        int x, y;
        iconContainer* icn;
        
};

class mapCursClient : public sigc::trackable{
    public:
        virtual void recieveCursor(int x, int y) = 0;
};
#endif	/* _MAPDISPLAY_H */

